[T2407] FIX : Correct opportunities count calculation - #2115
Open
Ylulu71D wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the custom _compute_opportunity_count method from the res.partner model in crm_compassion/models/res_partner.py. I have no feedback to provide on these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Ylulu71D
marked this pull request as ready for review
July 20, 2026 14:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
The goal of this PR is to fix an inaccurate opportunity counter displayed on
res.partnerrecords.History & Issue:
November 2025: A custom adjustment was introduced to count all historical opportunities (ongoing or archived) linked to a customer—whether an individual, a company entity, or a rollup of all individuals linked to that company.
June 2026: Following an official update to the Odoo core
crmandwebsite_crm_partner_assignadd-ons, this legacy custom code began double-counting archived records. This caused the UI counter to unexpectedly inflate (e.g., displaying a count of 5 instead of 3 for a partner with 1 active and 2 archived opportunities).This PR corrects the calculation by removing the redundant logic, ensuring the pipeline overview displays accurate totals for users.
Technical Aspects
The bug stemmed from a redundancy in the Method Resolution Order (MRO) inheritance chain of the
_compute_opportunity_countfunction across three modules: Corecrm,website_crm_partner_assign, and the compassion custom modulecrm_compassion.crmalready calculates a grand total of historical opportunities (both active and archived) out of the box usingwith_context(active_test=False). Furthermore, it natively handles the hierarchical roll-up, meaning a member's opportunities automatically bubble up to their parent company via achild_ofoperator search.crm_compassionmodule contained a redundant override that explicitly queried archived opportunities('active', '=', False)and forcefully appended them to the existing tally using+=. Because Core Odoo had already counted these archived records in step one, this custom logic caused them to be double-counted._compute_opportunity_countmethod has been entirely removed fromcrm_compassion. This allows Odoo's native inheritance chain to accurately resolve the count while fully preserving the official intermediate logicwebsite_crm_partner_assignand the native member-to-company hierarchical roll-up.Misc
Testing & Verification Steps
3).3(representing 1 active + 2 archived) instead of inflating to5.